1. Field of the Invention
The present invention relates to a microcomputer comprising a USB interface circuit for interfacing data transmission and receipt between a host and the microcomputer through a USB signal line.
2. Description of the Related Art
In recent years, the support of a USB (Universal Serial Bus) has been started in order to increase the degree of freedom of extension of a peripheral device for a personal computer etc. The USB is a serial interface standard which are devised in consideration of the convenience of a user and can be used in common with a communication between various peripheral devices such as a keyboard, a mouse, a camera, a printer, a scanner or a speaker and a personal computer etc.
FIG. 4 is a diagram showing an example of the connecting structure of a personal computer and a peripheral device utilizing the USB. A higher level personal computer 100 and a hub 101 can be connected to each other through a USB cable, and furthermore, peripheral devices 102 to 105 can be connected to the lower level of the hub 101. The peripheral devices 102 to 105 are managed by the personal computer 100. Thus, the USB is a so-called bi-directional communicatable serial bus having a network structure of a multi-star type.
The USB cable includes four signal lines. Two of them are used for a power source and the others are used for a data signal. The data signal is basically handled as a differential signal (D+, Dxe2x88x92). Moreover, data transfer utilizing the USB is subjected to time sharing on the concept that a transfer unit is a frame, and is carried out by superposing the frame.
One frame is started with an SOF (Start Of Frame) packet. The host personal computer sequentially transmits a data transfer request token (a data input request sent from a keyboard or a camera and a request for outputting voice data) scheduled within the started frame in advance, thereby carrying out data transfer together with a plurality of peripheral devices at the same time.
Examples of a document for technology of the USB include xe2x80x9cInterfacexe2x80x9d (January, 1997) and JP-A-11-205412.
When the device is connected to the USB cable, the personal computer 100 recognizes a change in the state of the data signal line (a change of one of the two signal lines from a pull-down state to a pull-up state) and knows that the device is turned on. Then, the personal computer 100 issues a bus reset signal prior to a data communication. Upon receipt of the bus reset signal, the device carries out initialization within a constant time.
However, since a considerable time is required for the initialization, communication data transmitted after the issuance of the bus reset signal cannot be received on the device side. In the case of the microcomputer, particularly, the initialization is carried out by power-on reset when the power is turned on. In the process for the initialization, a considerable time is required before the operation of a quartz oscillator for generating a synchronous system clock corresponding to the USB is stabilized.
In the case in which the communication data are transmitted immediately after the personal computer 100 issues the bus reset signal, the communication data cannot be normally received because the system clock of the microcomputer 100 is unstable.
It is an object of the invention to provide a microcomputer comprising a USB interface capable of reliably receiving communication data also in the case in which a personal computer to be a host knows that the microcomputer is connected to a USB cable and transmits the communication data immediately after the issuance of a bus reset signal.
The invention provides a microcomputer comprising a USB interface circuit for interfacing transmission and receipt of data between a host and the microcomputer through a USB signal line, comprising state setting means for setting the USB signal line to a level in a non-connection state for a period before the USB interface circuit can respond to a bus reset signal sent from the host.
Also in the case in which the host knows that the microcomputer is connected to the USB signal line and transmits communication data immediately after the issuance of the bus reset signal, consequently, the communication data can be received reliably.
Moreover, the state setting means includes an output terminal to be also used as a terminal to which the USB signal line is connected, a reset signal generating circuit for generating a reset signal upon receipt of power supply from the USB signal line, and a first oscillator for starting oscillation immediately in response to the reset signal, and operates the microcomputer by using an output of the first oscillator as a system clock and sets a level of the output terminal, thereby forcibly setting the USB signal line to a level in a non-connection state.
According to such a structure, since the state can be set on a software basis by utilizing the function of the microcomputer, there is an advantage that a special timing circuit is not required. Moreover, there is provided the output terminal to be also used as the terminal to which the USB signal line is connected. Consequently, there is also an advantage that the output terminal can be utilized effectively.
Furthermore, the microcomputer further comprises a second oscillator serving to start oscillation in response to the reset signal and having a stabler oscillation frequency and a longer oscillation starting time than those of the first oscillator, and a selecting circuit for selecting one output from the first and second oscillators and outputting the selected output for a system clock, wherein the selecting circuit selects the output of the first oscillator in response to the reset signal and selects the output of the second oscillator after an oscillation state of the second oscillator is stabilized.
According to such a structure, the output of the first oscillator can be utilized for the system clock to set the state of the USB signal line before the oscillation state of the second oscillator is stabilized, and the second oscillator can be utilized as the system clock for a USB communication after the oscillation state of the second oscillator is stabilized.